import socket

host = "127.0.0.1"
port = 6666
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host, port))
s.listen(1)
print("listening at port",port)
conn,addr = s.accept()
print("Connect by:", addr)
while True:
    data = conn.recv(1024)
    data = data.decode("utf-8")
    if not data:
        break
    print("received message",data)
    conn.sendall(input("response"))
conn.close()
s.close()